package uicgas.pump;

import java.awt.EventQueue;

import uicgas.globaldevice.CardReader;
import uicgas.globaldevice.MockCardReader;
import uicgas.pump.gui.impl.UserInputSimulator;
import uicgas.pump.impl.PumpLogicImpl;

/**
 * This class is used to start pump
 * 
 * @author Hong Wang
 */
public class RunPump
{
	/**
	 * Start pump and link the pump with a credit card reader;<br>
	 * Then start UserInputSimulator to simulate user interactions
	 * 
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception
	{
		final PumpLogicImpl pumpLogic = new PumpLogicImpl();

		final CardReader cardReader = new MockCardReader(pumpLogic);
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					UserInputSimulator frame = new UserInputSimulator(
							pumpLogic, cardReader);
					frame.setResizable(false);
					frame.setVisible(true);
				}
				catch (Exception e)
				{
				}
			}
		});
	}
}
